package net.lesscoding.shop.controller;

import net.lesscoding.shop.common.Result;
import net.lesscoding.shop.entity.User;
import net.lesscoding.shop.entity.UserMoneyLog;
import net.lesscoding.shop.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author eleven
 * @date 2024/6/14 9:26
 * @apiNote
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("/updateUserMoney")
    public Result updateUserMoney(@RequestBody UserMoneyLog userMoneyLog) {
        return userService.updateUserMoney(userMoneyLog);
    }
    @GetMapping("/{userId}")
    Result<User> getById(@PathVariable Long userId) {
        return Result.success(userService.getById(userId));
    }
}
